#include <QtGui/QMessageBox>
#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
  : QMainWindow(parent)
  , ui(new Ui::MainWindowClass)
  , m_pDesignerScene(NULL)
{
  ui->setupUi(this);
  ui->webView->hide();

  m_pViewActionGroup = new QActionGroup(this);
  m_pViewActionGroup->addAction(ui->actionDesigner);
  m_pViewActionGroup->addAction(ui->actionPreview);

  // Temporary code just to draw something into the designer...
  QGraphicsScene* pScene = new DesignerScene;

  ui->graphicsView->setScene(pScene);
  m_pDesignerScene = (DesignerScene*)pScene;
}

////////////////////////////////////////////////////////////////////////////////////////////////

MainWindow::~MainWindow()
{
  delete ui;
  delete m_pDesignerScene;
  delete m_pViewActionGroup;
}

////////////////////////////////////////////////////////////////////////////////////////////////

void MainWindow::on_actionOpen_Project_triggered()
{
}

////////////////////////////////////////////////////////////////////////////////////////////////

void MainWindow::on_actionDesigner_triggered()
{
  ui->graphicsView->setScene(m_pDesignerScene);
  ui->webView->hide();
  ui->graphicsView->show();
}

////////////////////////////////////////////////////////////////////////////////////////////////

void MainWindow::on_actionPreview_triggered()
{
  ui->graphicsView->hide();
  ui->webView->show();
}

////////////////////////////////////////////////////////////////////////////////////////////////

void MainWindow::on_actionExit_triggered()
{
  QCoreApplication::instance()->exit(0);
}
